package br.com.sgmf.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import br.com.sgmf.dao.ModeloDAO;
import br.com.sgmf.model.Modelo;

@Service
public class ModeloService {

	@Autowired
	private ModeloDAO modeloDAO;

	public void saveOrUpdate(Modelo modelo) {
		if (modelo.getId() == null) {
			modeloDAO.save(modelo);
		} else {
			modeloDAO.update(modelo);
		}
	}

	public void delete(Modelo modelo) {
		modeloDAO.delete(modelo);
	}

	public Modelo findById(Integer id) {
		return modeloDAO.findById(id);
	}

	public List<Modelo> findAll() {
		return modeloDAO.findAll();
	}
}
